'use strict';function _9t(a,e,f){var g="";for(let [n,p]of _hf._h){var b=p.bounds,c=p.workArea,d=n,k=b.width/6,m=b.height/6,h=b.top/6,l=b.left/6,r=(c.top-b.top)/6;b=(c.left-b.left)/6;var t=c.width/6;c=c.height/6;if(a.unit&&"tile"!=a.unit)var q="";else q=_9d(e,n),q=`<grid>${`<row>${"<tile></tile>".repeat(q.cols)}</row>`.repeat(q.rows)}</grid>`;g+=`\n <screen monId="${d}" style="width: ${k}px ; height: ${m}px; top: ${h}px; left:${l}px">\n <workarea style="top: ${r}px; left: ${b}px; width: ${t}px; height: ${c}px">\n ${q}\n <name>${p.name}</name>\n </workarea>\n </screen>\n `}a=
"";for(let [n,p]of f)a+=`<win class="${p}" style="left: ${n.x/6}px ; top: ${n.y/6}px ; width: ${n.w/6}px ; height: ${n.h/6}px"></win>`;f=_hf._h.desktop;e=f.w/6+2;d=f.h/6+2;return`<screenLayout style="min-width: ${e}px; min-height: ${d}px"><viewport style="width: ${e}px ; height: ${d}px">\n <origin style="top: ${-f.y/6-1}px ; left: ${-f.x/6-1}px">\n ${g}\n ${a}\n </origin>\n </viewport></screenLayout>`}
function _Ys(a,e,f){_hf._vi(()=>{let g=_Uu(a),b=_er(g.gridLayout,"gridLayout").value;if(g.unit){var c=_hf._sk[e]||_hf._sk[_hf._Pd],d=_kk(_ti(c));let k=_hf._je(d,b,g);d=[[d,"win1"],[k,"win2"]]}else{g.baseMonitor||(g.baseMonitor=Object.keys(_hf._h)[0]);let [k,m]=_hf._Xj(g);d=Array(m).fill(0,0).map(()=>[k.next().value,"tile"])}f(_9t(g,b,d),(c||{}).id)})}
function _Rt(a,e,f){_Ys(a,e,(g,b)=>{f(`\n <preview>${g}</preview>\n ${b?`\n <leyend><i class=win1></i>Before <i class=win2></i>After <h h=win></h></leyend>\n ${_ow([..._hf._sk].map(([c,d])=>[c,d.activeTab.title]),b)}\n `:"\n <leyend><i class=tile></i>Tiling area <h h=til></h></leyend>\n "}\n `,b)})}
function _qa(a,e){_Rt(a,_hf._Pd,(f,g)=>{let b=$(`<winActionPreview dontCloseOnFocusLost DataModule helpCtx="../winActPrev">${f}</winActionPreview>`)[0],c=_Ow(100,()=>{_Ys(a,$("select",b).val(),h=>$("preview",b).html(h))}),d=_se(200,()=>{_Rt(a,$("select",b).val(),h=>b.innerHTML=h)});$([a,b]).on("input change redefine",c);const k=["onCreated","onRemoved","onActivated","onUpdated","onMoved"];if(g){_5g(_Ky.tabs,k,d);let h={};var m=setInterval(()=>{_ye(+$("select",b).val(),!1,l=>{if(_fy())return d();l.keep("left",
"top","width","height");h.includes(l)||(c(),h=l)})},400)}$(b).on("close",function(){$(a).removeClass("popup").off("",c);_Ki(_Ky.tabs,k,d);clearInterval(m);$(this).remove()});e(b)})}
function _6r(a,e,f,g,b,c){let d=_kk(_ti(_hf._sk[c]));c=b.baseMonitor||_hf._Oh(d);let k=_hf._ii(_er(b.gridLayout,"gridLayout").value,c),m=e.in("x","w")?"w":"h";e=(h,l)=>Math.round(h*Math.pow(d[m]/100,l));b=(h,l)=>Math.round(h*Math.pow(k[m],l));switch(g){case "px":return"%"==f?e(a,1):b(a,1);case "tile":return b("%"==f?e(a,1):a,-1);case "%":return e("tile"==f?b(a,1):a,-1)}}
function _oe(a){a.previewPane?_2j(a):_qa(a,e=>{a.previewPane=_Jh(e,$(a).closest("[popupCntr]")[0]||a,"lbrt ,BR","tailOnly noTail under");$(a.previewPane).removeAttr("popupCntr")})}function _2j(a){$(a.previewPane).triggerEvt("close");delete a.previewPane}function _Ft(){return'<preview title="See a live preview of the action"><w1>Preview</w1><w2>Hide</w2><br>result</preview>'};
